<template>
	<view>
		<!--<uni-popup ref="popup" type="bottom" :animation="true" @change="change">-->
			<view v-if="boxShow" class="popup_content" >
				
				
				<view class="panel_box">
					<view class="panel_box_title">业务员信息</view>
					
					<view class="popup_list_item" v-if="salerInfo.user_name">
						<view class="item_left">
							<view class="item_left_top">
								<view class="item_title">{{salerInfo.user_name}}</view>
								<!--<view class="item_sub_title">{{salerInfo.tel}}</view>-->
								<view class="item_type" v-if="salerInfo.user_code" >{{salerInfo.user_code}}</view>
							</view>
							<view class="item_left_bottom">
								<view class="left_bottom_box">
									{{salerInfo.tel}}
								</view>
								<view class="left_bottom_box"  v-if="salerInfo.email">
									{{salerInfo.email}}
								</view>
							</view>
						</view>
					</view>
							
					
					<view class="panel_content">
						<view style="margin:auto;margin-top: 30rpx; margin-bottom: 20rpx; width: 300rpx;">
							<button type="default" class="button"  size="mini" style="width:100%;background-color: #910a15;color: #fff; font-size: 30rpx;" @click="selectSaler()">选择业务员</button>				
						</view>
					</view>
					
				</view>
				
				
				
				<view class="panel_box">
					<view class="panel_box_title">客户信息</view>
					
					<view class="qrcode_img" v-if="!customerInfo.customer_name&&qrcodeUrl">
						<image  mode="aspectFill" :src="qrcodeUrl"></image>
					</view>

					<view class="popup_list_item" v-if="customerInfo.customer_name">
						<view class="item_left">
							<view class="item_left_top">
								<view class="item_title">{{customerInfo.customer_name}}</view>
								<!--<view class="item_sub_title">{{customerInfo.tel}}</view>-->
								<view class="item_type">{{customerInfo.customer_kind}}</view>
							</view>
							<view class="item_left_bottom">
								<view class="left_bottom_box">
									{{customerInfo.tel}}
								</view>
								<view class="left_bottom_box">
									{{customerInfo.address}}
								</view>
							</view>
						</view>
					</view>
							
					
					<view class="panel_content">
						<view style="margin:auto;margin-top: 30rpx; margin-bottom: 20rpx; ">
							<view style="width:280rpx;overflow: hidden;float: left;margin-left: 40rpx;">
								<button type="default" class="button"  size="mini" style="background-color: #910a15;color: #fff; font-size: 30rpx;" @click="selectCustomer()">选择客户</button>	
							</view>
							<view style="width:280rpx;overflow: hidden;float: right;margin-left: 20rpx;  ">
								<button type="default" class="button"  size="mini" style="background-color: #910a15;color: #fff; font-size: 30rpx;" @click="showCode()">二维码</button>		
							</view>
						</view>
						
					</view>
					
					<!--<view class="panel_content">
						<view style="margin:auto;margin-top: 30rpx; margin-bottom: 20rpx; width: 300rpx;">
							<button type="default" class="button"  size="mini" style="width:100%;background-color: #910a15;color: #fff; font-size: 30rpx;"  :data-url="'/pages/get_user/index?user_id='+member.id+'&product_id='+product.id" @click="goPage" >测试按钮</button>				
						</view>
					</view>-->

				</view>
				
				
				<!--<view class="panel_box" >
					<view class="panel_box_title">选择账套</view>
					<view class="popup_form">
						<view class="form_item"  style="width: 90%;">
							<view class="form_item_name"  style="width: 20%;">账套：</view>
							<view class="form_item_input">
								<picker @change="selectChange" data-key="account_num"  :value="selectList['account_num']['index']" :range="selectList['account_num']['item']" :range-key="selectList['account_num']['key']">
									<view style="padding-left: 20rpx;line-height: 60rpx;" class="uni-input">{{selectList['account_num']['item'][selectList['account_num']['index']][selectList['account_num']['key']]}}</view>
								</picker>
							</view>
						</view>
					</view>
				</view>-->
				
				<view class="panel_box" >
					<view class="panel_box_title">选择门店</view>
					<view class="popup_form">
						<view class="form_item"  style="width: 90%;">
							<view class="form_item_name"  style="width: 20%;">门店：</view>
							<view class="form_item_input">
								<picker @change="selectChange" data-key="shop_id" :value="selectList['shop_id']['index']" :range="selectList['shop_id']['item']" :range-key="'cStoreName'">
									<view style="padding-left: 20rpx;line-height: 60rpx;" class="uni-input">{{selectList['shop_id']['item'][selectList['shop_id']['index']].cStoreName}}</view>
								</picker>
							</view>
						</view>
					</view>
				</view>
		
				<view class="panel_box"  v-if="productInfo.pcategory=='汽车膜'">
					<view class="panel_box_title">选择贴膜师傅</view>
					<view class="popup_form">
						<view class="form_item"  style="width: 90%;">
							<view class="form_item_name"  style="width: 20%;">贴膜师傅：</view>
							<view class="form_item_input">
								<picker @change="selectChange" data-key="worker" :value="selectList['worker']['index']" :range="selectList['worker']['item']" :range-key="selectList['worker']['key']">
									<view style="padding-left: 20rpx;line-height: 60rpx;" class="uni-input">{{selectList['worker']['item'][selectList['worker']['index']].name}}</view>
								</picker>
							</view>
						</view>
					</view>
				</view>
				
				<view class="panel_box" v-if="productInfo.pro_type==2" >
					<view class="panel_box_title">仓库类型</view>
					<view class="popup_form">
						<view class="form_item"  style="width: 90%;">
							<view class="form_item_name"  style="width: 20%;">仓库类型：</view>
							<view class="form_item_input">
								<picker @change="selectChange" data-key="store_type" :value="selectList['store_type']['index']" :range="selectList['store_type']['item']" :range-key="selectList['store_type']['key']">
									<view style="padding-left: 20rpx;line-height: 60rpx;" class="uni-input">{{selectList['store_type']['item'][selectList['store_type']['index']].name}}</view>
								</picker>
							</view>
						</view>
					</view>
				</view>
				
				<view class="panel_box"  v-if="productInfo.pro_type==1">
					<view class="panel_box_title">上传设计稿</view>
					<view class="panel_content">
						<app-upload :images.sync="images"></app-upload>
					</view>
				</view>
				
				
				<view class="panel_box" v-if="productInfo.pro_type==1" >
					<view class="panel_box_title">录入参数</view>
					<view class="popup_form">
						
						<view class="form_item" >
							<view class="form_item_name">宽(MM)：</view>
							<view class="form_item_input">
								<input v-model="formData.width"  type="text" class="uni-input"   placeholder-style="color:#a9a9a9" placeholder="单位:MM" />
							</view>
						</view>
		
						<view class="form_item" v-if="productInfo.pcategory!='缠绕膜'">
							<view class="form_item_name">长(M)：</view>
							<view class="form_item_input">
								<input name="length"  v-model="formData.length"   type="text" class="uni-input" placeholder-style="color:#a9a9a9" placeholder="单位:M" />
							</view>
						</view>
						
						
				
						<view class="form_item">
							<view class="form_item_name">装箱数：</view>
							<view class="form_item_input">
								<input v-model="formData.piece_num" @input="computeData()"  type="text" class="uni-input"  placeholder-style="color:#a9a9a9"  placeholder="单位:卷" />
							</view>
						</view>
						
						<view class="form_item">
							<view class="form_item_name">总箱数：</view>
							<view class="form_item_input">
								<input v-model="formData.box_num"  @input="computeData()"  type="text" class="uni-input"  placeholder-style="color:#a9a9a9"  placeholder="单位:箱" />
							</view>
						</view>
		
						<view class="form_item">
							<view class="form_item_name">总数量：</view>
							<view class="form_item_input">
								<input v-model="formData.roll_num" @input="priceChange()"  type="text" class="uni-input"   placeholder-style="color:#a9a9a9" placeholder="单位:卷" />
							</view>
						</view>
						
						<view v-if="productInfo.pcategory=='缠绕膜'">
							<view class="form_item">
								<view class="form_item_name">膜重量：</view>
								<view class="form_item_input">
									<input v-model="formData.cr_weight"   type="text" class="uni-input"   placeholder-style="color:#a9a9a9" placeholder="单位:公斤" />
								</view>
							</view>
						</view>
						
						<!--产品下拉属性-->
						<view class="form_item" v-for="(item,index) in selectList" v-if="item['item'].length>0&&item['data']!=''" :key="item[index]['name']">
							<view class="form_item_name">{{item["name"]}}：</view>
							<view class="form_item_input">
								<picker @change="selectChange" :data-key="index" :value="item['index']" :range="item['item']" :range-key="item['key']">
									<view style="padding-left: 20rpx;line-height: 60rpx;" class="uni-input">{{item['item'][item['index']][item["key"]]}}</view>
								</picker>
								
							</view>
						</view>
				
						<view class="form_item"  style="width: 100%;">
							<view class="form_item_name" style="width: 16%;">备注：</view>
							<view class="form_item_input" style="width: 70%;">
								<input v-model="formData.mark"  type="text" class="uni-input"  placeholder-style="color:#a9a9a9" placeholder=" " />
							</view>
						</view>
						
						<view class="form_item" style="width: 100%;">
							<view class="form_item_name" style="width: 16%;">印刷：</view>
							<view class="form_item_input" style="width: 70%;">
								<input v-model="formData.print_txt"  type="text" class="uni-input"   placeholder-style="color:#a9a9a9" placeholder="请输入印刷内容" />
							</view>
						</view>
	
						
					</view>
					
					<view style="margin:auto;margin-top: 20rpx; margin-bottom: 20rpx; width: 300rpx;">
						<button type="default" class="button"  size="mini" style="width:100%;background-color: #910a15;color: #fff; font-size: 30rpx;" @click="computePrice()">计算成本</button>				
					</view>
	
				</view>
				
				<view class="panel_box" v-if="productInfo.pro_type==2&&specsShow" >
					<view class="panel_box_title">选择产品型号</view>
					<productSpecsSelect :dataInfo.sync="formData" :product.sync="productInfo" :changeInfo.sync="specsChange"></productSpecsSelect>
					<!--<view v-if="productInfo.product_type==1"  style="margin:auto;margin-top: 20rpx; margin-bottom: 20rpx; width: 300rpx;">
						<button type="default" class="button"  size="mini" style="width:100%;background-color: #910a15;color: #fff; font-size: 30rpx;" @click="computePrice()">计算成本</button>				
					</view>-->
				</view>
		
				<view class="panel_box" v-if="costShow">
					<view class="panel_box_title">价格详情</view>
					<view class="panel_content">
						<view class="panel_detail"  >
							
							<view class="tr stripe" v-for="(item,index) in costInfo" :key="index">
								<view v-if="['price_float','cbpf_price','zdpf_price','CR_K4','CR_M4'].indexOf(index)==-1">
									<view class="td td_1">{{fieldMap[index]}}</view>
									<view class="td td_2">{{item}}</view>
								</view>
							</view>

						</view>
						
						
					</view>
					
				</view>
				
				<view class="panel_box" v-if="costShow">
					<view class="panel_box_title">报价参考</view>
					<view class="panel_content" >
						<view class="panel_detail">
							
							<view class="tr stripe" v-for="(item,index) in costInfo['price_float']" :key="index" >
								<view v-if="index!='price_float'">
									<view style="overflow: hidden;">
										<view class="td td_1">{{item.customer_type}}:</view>
										<view class="td td_2"  v-if="item.price_low"> {{item.price_low}}(最低价)</view>
										<view class="td td_3">{{item.price}}(指导价)</view>
									</view>
									<view style="overflow: hidden;">
										<view class="td td_1" v-if="costInfo.cbpf_price" >平方价:</view>
										<view class="td td_5" v-if="costInfo.cbpf_price" >{{costInfo.cbpf_price}}(最低价)</view>
										<view class="td td_6" v-if="costInfo.zdpf_price" >{{costInfo.zdpf_price}}(指导价)</view>
									</view>
									
									<view style="overflow: hidden;">
										<view class="td td_1" v-if="costInfo.CR_K4" >公斤价:</view>
										<view class="td td_5" v-if="costInfo.CR_K4" >{{costInfo.CR_K4}}(成本价)</view>
										<view class="td td_6" v-if="costInfo.CR_M4" >{{costInfo.CR_M4}}(指导价)</view>
									</view>
								</view>
							</view>
							
						</view>
					</view>
					
				</view>
				
				
				
				
				
				<view class="panel_box" >
					<view class="panel_box_title">报价</view>
					
					<view class="popup_form">
						<view class="form_item" >
							<view class="form_item_name"  style="width: 35%;">箱单价：</view>
							<view class="form_item_input"  style="width: 60%;">
								<input name="length"  v-model="formData.box_price"  @input="boxPriceChange()" type="text" class="uni-input"   placeholder=" " />
							</view>
						</view>
						
					</view>
					<view class="popup_form">
						
						<view class="form_item" >
							<view class="form_item_name"  style="width: 35%;">卷单价：</view>
							<view class="form_item_input"  style="width: 60%;">
								<input name="length"  v-model="formData.price"  @input="priceChange()" type="text" class="uni-input"   placeholder=" " />
							</view>
						</view>
						
						<view class="form_item" >
							<view class="form_item_name"  style="width: 30%;">总价：</view>
							<view class="form_item_input"  style="width: 60%;">
								<input name="length"  v-model="formData.total"  @input="totalChange()"  type="text" class="uni-input"   placeholder=" " />
							</view>
						</view>
								
					</view>
				</view>
				
				
				<view style="margin-top: 60rpx;" >
					<button type="default" class="button" style="background-color: #910a15;color: #fff; font-size: 30rpx;" @click="submitForm()">提交</button>				
				</view>
				<orderCustomerPopup :show.sync="popupShow" :customer.sync="customerInfo" :data.sync="customerData"></orderCustomerPopup>
				<orderSalerPopup :show.sync="salerShow" :dataInfo.sync="salerInfo"></orderSalerPopup>
				
				<app-text-box  title="信息确认" :show.sync="showTip" :content.sync="showTxt" :isConfirm.sync="isConfirm"></app-text-box>
				
				
				<u-modal content="请选择?" confirmText="前往订单" cancelText="继续购买" :show="showSkip" showCancelButton closeOnClickOverlay @confirm="formSkip(1)" @cancel="formSkip(2)"  ></u-modal>
				
			</view>

		<!--</uni-popup>-->
	</view>
</template>
<script>

</script>


<script>
	import {index} from './create-order-popup.js';
	import orderCustomerPopup from '@/pages/product/components/order-customer-popup/order-customer-popup.vue';
	import orderSalerPopup from '@/pages/product/components/order-saler-popup/order-saler-popup.vue';
	import productSpecsSelect from '@/pages/product/components/product-specs-select/product-specs-select.vue';
	export default {
		name: 'createOrderPopup',
		components: {'orderCustomerPopup': orderCustomerPopup,"orderSalerPopup":orderSalerPopup,"productSpecsSelect":productSpecsSelect},
		mixins: [index]
	}
</script>

<style>
	@import 'create-order-popup.css';
</style>
